package com.koron.sinoprobe.web.purchase.service;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.koron.bean.query.PageQuery;
import com.koron.sinoprobe.web.purchase.bean.po.SpPurchaseStaffs;
import org.koron.ebs.mybatis.SessionFactory;

import java.util.List;

/**
 * 采购验收-验收人员(SpPurchaseStaffs)表服务接口
 *
 * @author jzp
 * @since 2022-01-08 12:38:52
 */
public interface SpPurchaseStaffsService {

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    SpPurchaseStaffs getById(SessionFactory factory, String id);

    /**
     * 查询所有数据
     *
     * @param spPurchaseStaffs 查询条件对象
     * @return 列表结果集
     */
    List<SpPurchaseStaffs> list(SessionFactory factory, SpPurchaseStaffs spPurchaseStaffs);

    List<SpPurchaseStaffs> listByAcceptId(SessionFactory factory, String id);

    /**
     * 分页查询
     *
     * @param spPurchaseStaffs 分页条件
     * @return 对象列表
     */
    default PageInfo<SpPurchaseStaffs> page(SessionFactory factory, PageQuery pageQuery, SpPurchaseStaffs spPurchaseStaffs) {
        PageHelper.startPage(pageQuery.getPage(), pageQuery.getPageSize(), pageQuery.getOrderBy());
        List<SpPurchaseStaffs> spPurchaseStaffsList = list(factory, spPurchaseStaffs);
        return new PageInfo<>(spPurchaseStaffsList);
    }

    /**
     * 新增数据
     *
     * @param spPurchaseStaffs 实例对象
     * @return 是否成功
     */
    boolean save(SessionFactory factory, SpPurchaseStaffs spPurchaseStaffs);

    boolean saveBatch(SessionFactory factory, List<SpPurchaseStaffs> lists);

    /**
     * 修改数据
     *
     * @param spPurchaseStaffs 实例对象
     * @return 是否成功
     */
    boolean update(SessionFactory factory, SpPurchaseStaffs spPurchaseStaffs);

    boolean deleteBatchIds(SessionFactory factory, List<String> ids);

    boolean removeByAcceptId(SessionFactory factory, String acceptId);

}
